package com.leeon.container.iterator;

import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;

import static net.mindview.util.Print.print;

public class ListIterationInteger {

    private static int lenght = 10;

    public static void main(String[] args){

        List<Integer> integers1 = new ArrayList<Integer>(lenght);
        List<Integer> integers2 = new ArrayList<Integer>(lenght);

        for (int i = 0; i < lenght; i++) {
            integers1.add(i + 100);
        }

        ListIterator<Integer> it1 = integers1.listIterator();

        while (it1.hasNext()){
            System.out.print(it1.next() + " ");
        }

        print();

        while (it1.hasPrevious()){
            integers2.add(it1.previous());
        }

        ListIterator<Integer> it2 = integers2.listIterator();
        while (it2.hasNext()){
            System.out.print(it2.next() + " ");
        }

    }

}
